<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateWechatOffiaccountBroadcastsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wechat_offiaccount_broadcasts', function (Blueprint $table) {
            //
            $table->id();
            $table->string('msg_id','50')->default('')->index();
            $table->string('media_type','10')->comment('素材类型');
            $table->string('media_id','255')->default('');
            $table->string('send_type','10')->comment('群发类型 ALL 所有人 TAG 根据微信标签发送 OPENID 根据openid发送');
            //$table->json('member_ids')->nullable()->comment('发送用户ids');
            $table->tinyInteger('has_send')->default(0)->comment('0 未发送 1已发送');
            $table->string('msg_status')->default(0)->comment('群发状态 send success表示发送成功，send fail表示发送失败，err(num)表示错误');
            $table->unsignedInteger('total_count')->default(0)->comment('tag_id下粉丝数；或者openid_list中的粉丝数');
            $table->unsignedInteger('filter_count')->default(0)->comment('过滤（过滤是指特定地区、性别的过滤、用户设置拒收的过滤，用户接收已超4条的过滤）后，准备发送的粉丝数');
            $table->unsignedInteger('sent_count')->default(0)->comment('发送成功的粉丝数');
            $table->unsignedInteger('error_count')->default(0)->comment('发送失败的粉丝数');
            
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wechat_offiaccount_broadcasts');
    }
}
